package cc.customer.quartzTask;

import cc.customer.aiEmport.dao.CaiEmpMapper;
import cc.customer.expCustomer.dao.ExEmpMapper;
import cc.customer.expCustomer.domain.ExEmp;
import cc.customer.ServicesUtils.NoticeUtils;
import cc.customer.bigEmport.damain.BigEmp;
import cc.customer.bigEmport.dao.BigEmpMapper;
import cc.customer.common.annotation.CronTag;
import cc.customer.common.utils.DateUtil;
import cc.customer.myCustomer.damain.MyCustomer;
import cc.customer.myCustomer.dao.MyCustomerMapper;
import cc.customer.onschool.dao.OnSchoolResourceMapper;
import cc.customer.onschool.domain.OnSchoolResource;
import cc.customer.rabbit.domain.CconvNotice;
import cc.customer.sendMsg.SendMagRecevicer;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import tk.mybatis.mapper.entity.Example;

@CronTag("quartTask")
public class quartTask {

    @Autowired
    private BigEmpMapper bigEmpMapper; //大资源
    @Autowired
    private ExEmpMapper exEmpMapper; //推广资源
    @Autowired
    private OnSchoolResourceMapper onSchoolResourceMapper; //网校资源
    @Autowired
    private MyCustomerMapper myCustomerMapper; //个人资源
    @Autowired
    private CaiEmpMapper caiEmpMapper;

    @Autowired
    private SendMagRecevicer sendMagRecevicer;

    //月报信息形成数据
    public void getMonthlyReport() {
        /**获取本月的各个类型的客户的数量 **/
        JSONObject object = new JSONObject();
        try {
            JSONObject monthlyCount = monthlyCount();
            //本月新增的客户的数量
            object.put("monthlyCount",monthlyCount);
            CconvNotice notice = NoticeUtils.monthReport();
            notice.setcConvCont(object.toJSONString());
            sendMagRecevicer.processMonthReport(notice);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**获取月报中**/
    private JSONObject monthlyCount(){
        JSONObject object = new JSONObject();
        String today = DateUtil.getCurrentDate("yyyy-MM");
        try {
            //查询所有得 本月新增 大资源客户
            Example example = new Example(BigEmp.class);
            example.createCriteria().andLike("bpCreatetime", today+"%");
            int AllBigToDay = bigEmpMapper.selectCountByExample(example);
            object.put("AllBigThisMonth",AllBigToDay);
            //查询所有得 本月新增 推广资源
            Example example2 = new Example(ExEmp.class);
            example2.createCriteria().andLike("cExTime", today+"%");
            int AllExToDay = exEmpMapper.selectCountByExample(example2);
            object.put("AllExThisMonth",AllExToDay);
            //查询所有得网校资源
            Example example3 = new Example(OnSchoolResource.class);
            example3.createCriteria().andLike("osImportTime", today+"%");
            int AllSchToday = onSchoolResourceMapper.selectCountByExample(example3);
            object.put("AllSchThisMonth",AllSchToday);
            //查询 所有得 本月个人资源
            Example example4 = new Example(MyCustomer.class);
            example4.createCriteria().andLike("myCusCreatetime", today+"%");
            int AllMyCusday = myCustomerMapper.selectCountByExample(example4);
            object.put("AllMyCusMonth",AllMyCusday);
        }catch (Exception e){
            e.printStackTrace();
        }
        return object;
    }
    /**大资源-自学考试 自动调入公海**/
    public void  taskBigEmpTozokao(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                bigEmpMapper.taskQuartzBigEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**大资源-普通专升本自动调入公海**/
    public void  taskBigEmpToGongZhuan(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                bigEmpMapper.taskQuartzBigEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**大资源-考研辅导 自动调入公海**/
    public void  taskBigEmpToGongkaoyan(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                bigEmpMapper.taskQuartzBigEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**大资源-在职研自动调入公海**/
    public void  taskBigEmpToGongzaiyan(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                bigEmpMapper.taskQuartzBigEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**大资源-教师资格证自动调入公海**/
    public void  taskBigEmpToGongjiaoshi(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                bigEmpMapper.taskQuartzBigEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**大资源-英语等级 自动调入公海**/
    public void  taskBigEmpToGongYingyu(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];String pro = pas[1];
                bigEmpMapper.taskQuartzBigEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**大资源-计算机等级 自动调入公海**/
    public void  taskBigEmpToGongJisuan(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                bigEmpMapper.taskQuartzBigEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**大资源-成考辅导 自动调入公海**/
    public void  taskBigEmpToGongChengkao(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];String pro = pas[1];
                bigEmpMapper.taskQuartzBigEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**大资源-网教统考 自动调入公海**/
    public void  taskBigEmpToGongWangjiao(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];String pro = pas[1];
                bigEmpMapper.taskQuartzBigEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**大资源-总裁班 自动调入公海**/
    public void  taskBigEmpToGongZongcai(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                bigEmpMapper.taskQuartzBigEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**大资源-出国留学 自动调入公海**/
    public void  taskBigEmpToGongChuguo(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];String pro = pas[1];
                bigEmpMapper.taskQuartzBigEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**大资源-自考省外 自动调入公海**/
    public void  taskBigEmpToGongZikaosheng(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                bigEmpMapper.taskQuartzBigEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }


    /**--------------------------------------------------------------推广-------------------------------------------------------------------**/
    /**推广资源-自学考试 自动调入公海**/
    public void  taskExEmpToGongZikao(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                exEmpMapper.taskQuartzExEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /** 推广资源普通专升本自动调入公海**/
    public void  taskExEmpToGongZhuan(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                exEmpMapper.taskQuartzExEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**推广资源-考研辅导 自动调入公海**/
    public void  taskExEmpToGongkaoyan(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                exEmpMapper.taskQuartzExEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**推广资源-在职研自动调入公海**/
    public void  taskExEmpToGongzaiyan(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                exEmpMapper.taskQuartzExEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**推广资源-教师资格证 自动调入公海**/
    public void  taskExEmpToGongjiaoshi(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                exEmpMapper.taskQuartzExEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**推广资源-英语等级 自动调入公海**/
    public void  taskExEmpToGongYingyu(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                exEmpMapper.taskQuartzExEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**推广资源-计算机等级 自动调入公海**/
    public void  taskExEmpToGongJisuan(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                exEmpMapper.taskQuartzExEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**推广资源-成考辅导 自动调入公海**/
    public void  taskExEmpToGongChengkao(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                exEmpMapper.taskQuartzExEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**推广资源-网教统考 自动调入公海**/
    public void  taskExEmpToGongWangjiao(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                exEmpMapper.taskQuartzExEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**推广资源-总裁班 自动调入公海**/
    public void  taskExEmpToGongZongcai(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                exEmpMapper.taskQuartzExEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**推广资源-出国留学 自动调入公海**/
    public void  taskExEmpToGongChuguo(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                exEmpMapper.taskQuartzExEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**推广资源-自考省外 自动调入公海**/
    public void  taskExEmpToGongZikaosheng(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                exEmpMapper.taskQuartzExEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }


    /**--------------------------------------------------------------AI-------------------------------------------------------------------**/


    /**AI资源-自学考试 自动调入公海**/
    public void  taskAiEmpToGongZikao(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                caiEmpMapper.taskQuartzAiEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /** AI资源普通专升本自动调入公海**/
    public void  taskAiEmpToGongZhuan(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                caiEmpMapper.taskQuartzAiEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**AI资源-考研辅导 自动调入公海**/
    public void  taskAiEmpToGongkaoyan(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                caiEmpMapper.taskQuartzAiEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**AI资源-在职研自动调入公海**/
    public void  taskAiEmpToGongzaiyan(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                caiEmpMapper.taskQuartzAiEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**AI资源-教师资格证 自动调入公海**/
    public void  taskAiEmpToGongjiaoshi(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                caiEmpMapper.taskQuartzAiEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**AI资源-英语等级 自动调入公海**/
    public void  taskAiEmpToGongYingyu(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                caiEmpMapper.taskQuartzAiEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**AI资源-计算机等级 自动调入公海**/
    public void  taskAiEmpToGongJisuan(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                caiEmpMapper.taskQuartzAiEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**AI资源-成考辅导 自动调入公海**/
    public void  taskAiEmpToGongChengkao(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                caiEmpMapper.taskQuartzAiEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**AI资源-网教统考 自动调入公海**/
    public void  taskAiEmpToGongWangjiao(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                caiEmpMapper.taskQuartzAiEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**AI资源-总裁班 自动调入公海**/
    public void  taskAiEmpToGongZongcai(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                caiEmpMapper.taskQuartzAiEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**AI资源-出国留学 自动调入公海**/
    public void  taskAiEmpToGongChuguo(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                caiEmpMapper.taskQuartzAiEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
    /**AI资源-自考省外 自动调入公海**/
    public void  taskAiEmpToGongZikaosheng(String parames){
        try {
            if (!StringUtils.isEmpty(parames)){
                String []pas= parames.split(",");
                String day = pas[0];
                String pro = pas[1];
                caiEmpMapper.taskQuartzAiEmp_gong(Integer.valueOf(day),pro);
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
